<%@ page contentType="text/html; charset=utf-8"%>
<%@ include file="/common/include.jsp"%>
<%@ taglib uri="http://java.fckeditor.net" prefix="FCK"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>公共信息发布</title>
		<jsp:include page="../../../common/head.jsp">
			 <jsp:param name="_useCalendar" value="true"/>
			 <jsp:param name="_useUpload" value="true"/>
		</jsp:include>
		<script language="javascript">

			//提交完成发布操作
			function doSubmit(){
				//把获取到的FCKEditor中的内容传给隐藏域
				var oEditor = FCKeditorAPI.GetInstance("fckeditor");  
				document.getElementById("infoContent").value=oEditor.GetXHTML(true);
				var objarr = new Array(
				["infoPublish.infoTitle","信息标题","notEmpty",""],
				["infoPublish.infoTitle","信息标题","max","String:100"],
				["infoPublish.publishTime","发布时间","notEmpty",""]
				);
				if(xj.CheckAll(objarr))
				{
					if(confirm("确认保存？"))
					{
						document.form1.target="_self";
						document.form1.action="updateInfoPublish.do";
						return true;
					}
				}
				return false;
			}
			//预览
			function preview(){
				//把获取到的FCKEditor中的内容传给隐藏域
				var oEditor = FCKeditorAPI.GetInstance("fckeditor");  
				document.getElementById("infoContent").value=oEditor.GetXHTML(true);
				document.form1.target="_blank";
				document.form1.action="previewInfoPublish.do";
				document.form1.submit();
				xjCommon.resetSubmitKey();
			}
			//从数据库中获取 FCKEditor的内容并显示在FCKEditor的文本域中
		    function FCKeditor_OnComplete() {  
    			var oEditor = FCKeditorAPI.GetInstance("fckeditor") ;  
    			oEditor.SetHTML(document.getElementById("infoContent").value);  
			}
			function closethis(){
				window.location.href="listInfoPublish.do?infoPublish.infoTypeL2=${infoPublish.infoTypeL2}&infoPublish.infoType=${queryInfoType}"
			}		 
		</script>
	</head>
	<body>
		<form name="form1" id="form1" action="updateInfoPublish.do" method="post" enctype="multipart/form-data">
			<input type="hidden" name="infoPublish.infoId" value="${infoPublish.infoId}"/>
			<input type="hidden" name="infoPublish.infoTypeL2" value="${infoPublish.infoTypeL2}" />
			<input type="hidden" name="queryInfoType" value="${queryInfoType}" />
			<input type="hidden" name="infoPublish.infoOrder" value="${infoPublish.infoOrder}" />
			<!-- 删除标志 -->
			<input type="hidden" name="infoPublish.infoState" value="${infoPublish.infoState}" />
			<!-- 发布人ID -->
			<input type="hidden" name="infoPublish.publishUserId" value="${infoPublish.publishUserId}" />
			<input type="hidden" name="infoPublish.publishUserName" value="${infoPublish.publishUserName}" />
			<div id="body_div">
				<w:ShowTitle name="公共信息发布">
					<w:TitleButton funcName="发布" onClickFunction="return doSubmit()" urlImg="${ctx}/images/main/save.png" funcType="submit" />
					<w:TitleButton funcName="预览" onClickFunction="preview()" urlImg="${ctx}/images/main/query.png" funcType="link" />
					<w:TitleButton funcName="返回" onClickFunction="closethis()" urlImg="${ctx}/images/main/back.png" funcType="link" />
				</w:ShowTitle>
			<div id="body_content">				
			<table width="99%">
				<tr>
					<td  class="right_align">
						信息标题
					</td>
					<td  class="left_align" colspan="3">
						<input name="infoPublish.infoTitle" type="text" value="${infoPublish.infoTitle}" size="80"/>
					</td>
				</tr>
				<tr>
					<td class="right_align">
						发布时间
					</td>
					<td class="left_align">
						<input type="text" value='<fmt:formatDate value="${infoPublish.publishTime}" pattern="yyyy-MM-dd"/>' onClick="WdatePicker()" name="infoPublish.publishTime" readonly="readonly" class="inputCal"/>
					</td>
					<td class="right_align" width="10%">信息类别</td>
					<td class="left_align">
						<c:choose>
						<c:when test="${queryInfoType ne null&& queryInfoType ne ''}">
						<w:select name="infoPublish.infoType" value="${infoPublish.infoType}">
							<w:options options="${CodeDict}" optionLabel="codeName" optionValue="codeId" filterFieldName="parentCodeId" filterFieldValue="${queryInfoType}"></w:options>
						</w:select>
						</c:when>
						<c:otherwise>
						<w:select name="infoPublish.infoType" value="${infoPublish.infoType}">
							<w:options options="${CodeDict}" optionLabel="codeName" optionValue="codeId" filterFieldName="parentCodeId" filterFieldValue="${infoPublish.infoTypeL2}"></w:options>
						</w:select>
						</c:otherwise>
						</c:choose>
					</td>
				</tr>
				<tr>
					<td class="right_align" width="10%">是否发布</td>
					<td class="left_align">
						<w:select name="infoPublish.publishState" value="${infoPublish.publishState}">
							<w:option optionLabel="是" optionValue="Y"></w:option>
							<w:option optionLabel="否" optionValue="N"></w:option>
						</w:select>
					</td>
					<td class="right_align">
					</td>
					<td class="left_align">
					</td>
				</tr>
				<tr>
					<td class="right_align" height="550">
						信息内容&nbsp;&nbsp;
					</td>
					<td colspan="3" class="left_align" valign="top">
						<!-- 添加FCK -->
						<FCK:editor instanceName="fckeditor" value=" " height="540"></FCK:editor>
						<!-- 信息内容 -->
						<textarea name="infoPublish.infoContent" id="infoContent" style="display:none">${infoPublish.infoContent}</textarea>
					</td>
				</tr>
				<tr>
					<td class="right_align">
						附&nbsp;&nbsp;&nbsp;&nbsp;件&nbsp;&nbsp;
					</td>
					<td colspan="3">&nbsp;
						<w:uploadFile isAdd="true" isList="true" folder="infoPublish" beanName="infoPublish" allowDeletions="true" belongId="${infoPublish.infoId}"></w:uploadFile>
					</td>
				</tr>
			</table>
			</div>
		</div>
		</form>
	</body>
</html>